<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="../js/jquery-1.8.3.min.js"></script>
<script src="../js/jquery.form.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>新增工作计划</title>

<script>

	$(function(){
			init();
			$.post('byTypeDDL.action',{'ddl.typeType':'重要程度'},function(data){
				putSelect('Importance',data);
			},'json');
			$.post('findAllUser.action',{'q':(new Date()).getTime()},function(data){
				putSelect('Superintendent',data);
				putSelect('userByUsResponsible',data);
			},'json');
			$('#form1').submit(function(){
				var option={success:function(data){
				alert('添加成功！正在关闭...');
				window.close();
			}};
			$('#form1').ajaxSubmit(option);
				return false;
			});
			$('#hh').change(function(){
				changeHH();	
			});
			$('#mm').change(function(){
				changeMM();	
			});
	});
	
	function putSelect(id,json){
		$('#'+id).html('');
		for(var i=0;i<json.length;i++){
			$('#'+id).append('<option value="'+json[i].id+'">'+json[i].value+'</option>');
		}
	}
	
	
	function init(){
		for(var i=0;i<60;i++){
			if(i<24){
				$('#hh').append('<option value="'+put0(i)+'">'+i+'</option>');
			}
			$('#mm').append('<option value="'+put0(i)+'">'+i+'</option>');
		}
	}
	
	function put0(num){
		if(num<10){
			return '0'+num;
		}
		return num;
	}
	
	function changeHH(){
		var str = 	$('#rtime').val();
		var start = str.substring(0,str.indexOf(' ')+1);
		var end  = str.substring(str.indexOf(':'),str.length);
		$('#rtime').val(start+$('#hh').val()+end);
	}
	
	function changeMM(){
		var str = 	$('#rtime').val();
		var start = str.substring(0,str.indexOf(':')+1);
		$('#rtime').val(start+$('#mm').val());
	}

</script>

</head>
<body>

<form name="form1" method="post" id="form1" action="addWorkPlan.action">
  <p>计划完成时间：
  <input name="dateStr" type="text" id="rtime" value="<%=request.getParameter("time")%> 00:00" size="15" readonly="readonly">
  <select name="hh" id="hh">
  </select>
  时
  <select name="mm" id="mm">
  </select>
  分</p>
  <p>重要程度：
    <select name="workPlan.DDLByTypeImportance.typeId" id="Importance">
    </select>
  </p>
  <p>责任人：
    <select name="workPlan.userByUsSuperintendent.usCid" id="Superintendent">
    </select>
  </p>
  <p>监督人：
    <select name="workPlan.userByUsResponsible.usCid" id="userByUsResponsible">
    </select>
  </p>
  <p>标题：
    <input type="text" name="workPlan.wpTitle" id="workPlan.wpTitle">
  </p>
  <p>内容：<br>
    <textarea name="workPlan.wpPlanbody" id="workPlan.wpPlanbody" cols="45" rows="5"></textarea>
  </p>
  <p>备注：
    <input type="text" name="workPlan.wpOther" id="workPlan.wpOther">
  </p>
  <p>
    <input type="submit" name="button" id="button" value="提交">
  </p>
</form>
<p>
private DDL DDLByTypeCompletion;//完成情况<br>
private DDL DDLByTypeImportance;//重要程度<br>
private User userByUsResponsible;//监督人<br>
private User userByUsSuperintendent;//责任人<br>
private String wpTitle;//标题<br>
private String wpPlanbody;//内容<br>
private Boolean wpMessagereminded;//是否消息提醒<br>
private Date wpRemindedtime;//计划完成时间<br>
private String wpProblem;//提出问题<br>
private String wpAnalysis;//利弊分析<br>
private String wpMeasureser;//行动措施<br>
private String wpOther;//备注<br>
private String wpAnalysiscompleted;//完成分析
</p>

</body>
</html>